package com.schoolcloud.files.service;

import com.schoolcloud.common.model.PageDTO;
import com.schoolcloud.common.model.R;
import com.schoolcloud.files.dto.ChunkCheckDTO;
import com.schoolcloud.files.dto.ChunkMergeDTO;
import com.schoolcloud.files.dto.FileInfoDTO;
import com.schoolcloud.files.entity.FileMain;
import com.schoolcloud.files.query.FileMainQuery;
import io.minio.errors.*;
import org.springframework.web.multipart.MultipartFile;

import java.io.IOException;
import java.io.InputStream;
import java.security.InvalidKeyException;
import java.security.NoSuchAlgorithmException;

public interface FileService {
    /**
     * @param file 文件
     * @param bucket 文件存储桶名
     * @param baseUrl 基本路径
     * @return {@link String} 文件存储路径
     */
    FileInfoDTO uploadFile(MultipartFile file, String bucket, String baseUrl,String sceneName) throws ServerException, InsufficientDataException, ErrorResponseException, IOException, NoSuchAlgorithmException, InvalidKeyException, InvalidResponseException, XmlParserException, InternalException;

    /**获取文件详情
     * @param filePath 文件路径
     * @return {@link FileInfoDTO}
     */
    FileInfoDTO getFileInfo(String filePath) throws ServerException, InsufficientDataException, ErrorResponseException, IOException, NoSuchAlgorithmException, InvalidKeyException, InvalidResponseException, XmlParserException, InternalException;

    boolean checkFileExist(String md5);

    boolean checkChunkExist(ChunkCheckDTO dto);

    boolean uplaodChunk(String sceneCode, MultipartFile file, String videoMD5, int chunk);

    R<?> mergeChunk(ChunkMergeDTO dto);

    FileInfoDTO commonUpload(MultipartFile file, String sceneName);

}
